home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / guile-ii.src / guile-ii / guile-src / libguile / __scm.h next >
Encoding:
C/C++ Source or Header  |  1995-07-02  |  6.8 KB  |  260 lines

  1. /* classes: h_files */
  2.  
  3. #ifndef __SCMH
  4. #define __SCMH
  5. /*    Copyright (C) 1995 Free Software Foundation, Inc.
  6.  * 
  7.  * This program is free software; you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License as published by
  9.  * the Free Software Foundation; either version 2, or (at your option)
  10.  * any later version.
  11.  * 
  12.  * This program is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  * GNU General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU General Public License
  18.  * along with this software; see the file COPYING.  If not, write to
  19.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  *
  21.  * As a special exception, the Free Software Foundation gives permission
  22.  * for additional uses of the text contained in its release of GUILE.
  23.  *
  24.  * The exception is that, if you link the GUILE library with other files
  25.  * to produce an executable, this does not by itself cause the
  26.  * resulting executable to be covered by the GNU General Public License.
  27.  * Your use of that executable is in no way restricted on account of
  28.  * linking the GUILE library code into it.
  29.  *
  30.  * This exception does not however invalidate any other reasons why
  31.  * the executable file might be covered by the GNU General Public License.
  32.  *
  33.  * This exception applies only to the code released by the
  34.  * Free Software Foundation under the name GUILE.  If you copy
  35.  * code from other Free Software Foundation releases into a copy of
  36.  * GUILE, as the General Public License permits, the exception does
  37.  * not apply to the code that you add in this way.  To avoid misleading
  38.  * anyone as to the status of such modified files, you must delete
  39.  * this exception notice from them.
  40.  *
  41.  * If you write modifications of your own for GUILE, it is your choice
  42.  * whether to permit this exception to apply to your modifications.
  43.  * If you do not wish that, delete this exception notice.  
  44.  */
  45.  
  46.  
  47. #define CAUTIOUS
  48. #define IO_EXTENSIONS
  49. #define PROMPT "guile> "
  50. #define FLOATS
  51. #define SINGLES
  52. #define MEMOIZE_LOCALS
  53. #define GC_FREE_SEGMENTS
  54. #define TICKS
  55. #define MEMOIZE_LOCALS
  56. #define SICP
  57. #define CCLO
  58. #define BIGNUMS
  59. #define ENGNOT
  60. #define ARRAYS
  61.  
  62.  
  63. /* This file is the miscellaneous pile of grody SCM macros and declarations.
  64.  *
  65.  * It contains definitions not of interest to a casual reader
  66.  * of guile.h or scm.h, but that are so central to the implementation
  67.  * that most source files need them.
  68.  *
  69.  * In this file, all exported names begin with "scm_" or "SCM_".
  70.  * In the private include file for library sources, "_scm.h", 
  71.  * short hand names are given for many CPP macros.
  72.  */
  73.  
  74.  
  75.  
  76. #ifdef HAVE_LIMITSH
  77. # include <limits.h>
  78. # ifdef UCHAR_MAX
  79. #  define SCM_CHAR_CODE_LIMIT (UCHAR_MAX+1L)
  80. # else
  81. #  define SCM_CHAR_CODE_LIMIT 256L
  82. # endif /* def UCHAR_MAX */
  83. # define SCM_MOST_POSITIVE_FIXNUM (LONG_MAX>>2)
  84. # ifdef _UNICOS            /* Stupid cray bug */
  85. #  define SCM_MOST_NEGATIVE_FIXNUM ((long)LONG_MIN/4)
  86. # else
  87. #  define SCM_MOST_NEGATIVE_FIXNUM SRS((long)LONG_MIN, 2)
  88. # endif                /* UNICOS */
  89. #else
  90. # define SCM_CHAR_CODE_LIMIT 256L
  91. # define SCM_MOST_POSITIVE_FIXNUM ((long)((unsigned long)~0L>>3))
  92. # if (0 != ~0)
  93. #  define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM-1)
  94. # else
  95. #  define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM)
  96. # endif /*  (0 != ~0) */
  97. #endif /* def HAVE_LIMITSH */
  98.  
  99.  
  100. #include <scmconfig.h>
  101. #include "tags.h"
  102.  
  103.  
  104. /** DEFER_INTS/ALLOW_INTS
  105.  ** 
  106.  **/
  107.  
  108. #ifdef SCM_NON_PREMPTIVE
  109.  
  110. # define SCM_DEFER_INTS /**/
  111. # ifdef SCM_TICKS
  112. #  define SCM_POLL \
  113.      { \
  114.        if (0==scm_poll_count--) scm_poll_routine(); \
  115.        if (0==scm_tick_count--) scm_tick_signal(); \
  116.      }
  117. # else
  118. #  define SCM_POLL \
  119.      { \
  120.        if (0==scm_poll_count--) \
  121.          scm_poll_routine(); \
  122.      }
  123. # endif /* def SCM_TICKS */
  124. # define SCM_CHECK_INTS SCM_POLL
  125. # define SCM_ALLOW_INTS SCM_POLL
  126. # define SCM_REDEFER_INTS /**/
  127. # define SCM_REALLOW_INTS SCM_POLL
  128.  
  129. #else  /* is premptive */
  130.  
  131.  
  132. # define SCM_REDEFER_INTS {++scm_ints_disabled;}
  133. # define SCM_REALLOW_INTS \
  134.    {\
  135.       --scm_ints_disabled; \
  136.       if (!scm_ints_disabled) \
  137.         SCM_CHECK_INTS;      \
  138.    }
  139.  
  140. # ifdef SCM_CAREFUL_INTS
  141. #  define SCM_DEFER_INTS {if (scm_ints_disabled) \
  142.               fputs("ints already disabled\n", stderr); \
  143.             scm_ints_disabled = 1;}
  144. #  define SCM_ALLOW_INTS {if (!scm_ints_disabled) \
  145.               fputs("ints already enabled\n", stderr); \
  146.             scm_ints_disabled = 0;SCM_CHECK_INTS}
  147. # else
  148. #  define SCM_DEFER_INTS {scm_ints_disabled = 1;}
  149. #  define SCM_ALLOW_INTS {scm_ints_disabled = 0;SCM_CHECK_INTS}
  150. # endif /* def SCM_CAREFUL_INTS */
  151.  
  152. # ifdef SCM_TICKS
  153. #  define SCM_CHECK_INTS \
  154.      {\
  155.        if (scm_sig_deferred)\
  156.           scm_han_sig(); \
  157.        if (scm_alrm_deferred) \
  158.           scm_han_alrm();\
  159.        SCM_POLL; \
  160.      }
  161. #  define SCM_POLL {if (0==scm_tick_count--) scm_tick_signal();}
  162. # else
  163. #  define SCM_CHECK_INTS {if (scm_sig_deferred) scm_han_sig();if (scm_alrm_deferred) scm_han_alrm();}
  164. #  define SCM_POLL /**/
  165. # endif /* def SCM_TICKS */
  166.  
  167. #endif /* def SCM_NON_PREMPTIVE */
  168.  
  169.  
  170.  
  171. /** ASSERT
  172.  ** 
  173.  **/
  174.  
  175.  
  176. #ifdef SCM_RECKLESS
  177. #define SCM_ASSERT(_cond, _arg, _pos, _subr)
  178. #define SCM_ASRTGO(_cond, _label)
  179. #else
  180. #define SCM_ASSERT(_cond, _arg, _pos, _subr) \
  181.     if (!(_cond)) \
  182.           scm_wta(_arg, (char *)(_pos), _subr)
  183. #define SCM_ASRTGO(_cond, _label) \
  184.         if (!(_cond)) \
  185.           goto _label
  186. #endif
  187.  
  188.  
  189. #define SCM_ARGn         0
  190. #define SCM_ARG1         1
  191. #define SCM_ARG2         2
  192. #define SCM_ARG3         3
  193. #define SCM_ARG4         4
  194. #define SCM_ARG5         5
  195. #define SCM_ARG6         6
  196. #define SCM_ARG7         7
  197. #define SCM_ARGERR(X)         ((X) < SCM_WNA \
  198.                  ? (char *)(X) \
  199.                  : "wrong type argument")
  200.  
  201. /* Following must match entry indexes in scm_errmsgs[].
  202.  * Also, WNA must follow the last ARGn in sequence.
  203.  */
  204. #define SCM_WNA         8
  205. #define SCM_OVFLOW         9
  206. #define SCM_OUTOFRANGE         10
  207. #define SCM_NALLOC         11
  208. #define SCM_EXIT         12
  209. #define SCM_HUP_SIGNAL         13
  210. #define SCM_INT_SIGNAL         14
  211. #define SCM_FPE_SIGNAL         15
  212. #define SCM_BUS_SIGNAL         16
  213. #define SCM_SEGV_SIGNAL     17
  214. #define SCM_ALRM_SIGNAL     18
  215.  
  216. struct errdesc
  217. {
  218.   char *msg;
  219.   char *s_response;
  220.   short parent_err;
  221. };
  222.  
  223.  
  224. extern struct errdesc scm_errmsgs[];
  225.  
  226.  
  227.  
  228. /* EXIT_SUCCESS is the default code to return from SCM if no errors
  229.  * were encountered.  EXIT_FAILURE is the default code to return from
  230.  * SCM if errors were encountered.  The return code can be explicitly
  231.  * specified in a SCM program with (scm_quit <n>).
  232.  */
  233.  
  234. #ifndef SCM_EXIT_SUCCESS
  235. # ifdef vms
  236. #  define SCM_EXIT_SUCCESS 1
  237. # else
  238. #  define SCM_EXIT_SUCCESS 0
  239. # endif /* def vms */
  240. #endif /* ndef SCM_EXIT_SUCCESS */
  241. #ifndef SCM_EXIT_FAILURE
  242. # ifdef vms
  243. #  define SCM_EXIT_FAILURE 2
  244. # else
  245. #  define SCM_EXIT_FAILURE 1
  246. # endif /* def vms */
  247. #endif /* ndef SCM_EXIT_FAILURE */
  248.  
  249.  
  250.  
  251.  
  252. #ifdef __STDC__
  253.  
  254. #else /* STDC */
  255.  
  256. #endif /* STDC */
  257.  
  258.  
  259. #endif  /* __SCMH */
  260.